﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Data.SqlClient;

namespace sdamarketing
{
    public class SaveHistory
    {
        public static void addHystoriForUser(int idUserChanging, int idUserChanged, int action)
        {
            SqlConnection connection = ConnectionMenager.GetConnection();
            DateTime date = DateTime.Now;

            string sql = @"INSERT INTO historyUsers (idUserChanging, idUserChanged, action, date) VALUES (@idUserChangingP,@idUserChangedP,@actionP,@dateP)";
            SqlCommand command = new SqlCommand(sql, connection);

            command.Parameters.AddWithValue("@idUserChangingP", idUserChanging);
            command.Parameters.AddWithValue("@idUserChangedP", idUserChanged);
            command.Parameters.AddWithValue("@actionP", action);
            command.Parameters.AddWithValue("@dateP", date);

            command.ExecuteNonQuery();
            connection.Close();
        }
    }
}
